package com.hcb.tonguetiphealth.widget.home.mirror;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;

import com.hcb.tonguetiphealth.view.HealthShareActivity;
import com.hcb.tonguetiphealth.view.R;
import com.hcb.tonguetiphealth.widget.GeneralWidget;

public class HealthMirrorWidget extends GeneralWidget implements OnClickListener {

	private Activity ctx;
	
	private LinearLayout llback;
	
	private Button btCheck;

	public HealthMirrorWidget(Context context) {
		super(context);
		ctx = (Activity) context;
		inflate(context, R.layout.health_mirror, this);
		//绑定底部菜单按钮
		//new BottomWidget(ctx, this);
		bindView();
		bindEvent();
	}

	 	
	private void bindView(){
		btCheck = (Button)findViewById(R.id.health_mirror_check_bt);
		llback = (LinearLayout)findViewById(R.id.linearout_back);
		
	}
	
	private void bindEvent(){
		btCheck.setOnClickListener(this);
		llback.setOnClickListener(this);
	}
	
	/**
	 * 底部功能菜单按钮点击事件
	 */
	public void onClick(View v) {
		switch (v.getId()) {
		 case R.id.linearout_back:
			ctx.finish();
			break;
		case R.id.health_mirror_check_bt:
			showMessage(ctx, "您的健康数据太少啦，快去传递健康吧！");
			try {
				Thread.sleep(2000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			ctx.startActivity(new Intent(ctx, HealthShareActivity.class));
			ctx.finish();
			break;
		default:
			break;
		}
	}

	@Override
	public void notifyAdapter() {

	}

}
